home *** CD-ROM | disk | FTP | other *** search
/ Univers Mac Interactif 42 / Univers Mac Interactif - Issue 42.iso / Internet / MacHTTP 2.0 / MacHTTP Software & Docs / Tutorials / Extending MacHTTP Scripts / Script1.txt < prev    next >
Text File  |  1994-12-11  |  3KB  |  51 lines

  1. -- set these properties outside of the event.  That way they will only be set 
  2. -- once each time the app is run, not once for each event.
  3. property crlf : (ASCII character 13) & (ASCII character 10)
  4. -- This is a standard header for HTML files.
  5. property http_10_header : "HTTP/1.0 200 OK" & crlf & "Server: MacHTTP" & crlf & ¬
  6.     "MIME-Version: 1.0" & crlf & "Content-type: text/html" & crlf & crlf
  7.  
  8. -- This is the loop for AppleEvents received by the application.
  9. -- When you check the syntax, AppleScript will ask you to locate 
  10. -- MacHTTP and will set the correct name at that time.
  11. on «event WWWΩsdoc» path_args ¬
  12.     given «class kfor»:http_search_args, «class post»:post_args, «class meth»:method, «class addr»:client_address, «class user»:username, «class pass»:password, «class frmu»:from_user, «class svnm»:server_name, «class svpt»:server_port, «class scnm»:script_name, «class ctyp»:content_type
  13.     -- Variables available for use:
  14.     -- http_search_args - stuff in the URL after a ?
  15.     -- post_args - stuff in the URL after a $
  16.     -- method - GET, POST, etc. Used to tell if post_args are valid
  17.     -- client_address - IP address or domain name of remote client's host
  18.     -- from_user - non-standard. e-mail address of remote user
  19.     -- username - authenticated user name
  20.     -- password - authenticated password
  21.     -- server_name - name or IP address of this server
  22.     -- server_port - TCP/IP port number being used by this server
  23.     -- script_name - URL name of this script
  24.     -- content_type - MIME content type of post_args
  25.     
  26.     -- Return each parameter so you can see what the unprocessed
  27.     -- information looks like.
  28.     set return_page to http_10_header ¬
  29.         & "<HTML><HEAD><TITLE>Unprocessed Results</TITLE></HEAD>" ¬
  30.         & "<BODY><H1>Unprocessed Results</H1>" & return ¬
  31.         & "<H4>http_search_args</H4>" & return & http_search_args
  32.     set return_page to return_page & return ¬
  33.         & "<H4>post_args</H4>" & return & post_args & return ¬
  34.         & "<H4>method</H4>" & return & method & return ¬
  35.         & "<H4>client_address</H4>" & return & client_address & return
  36.     set return_page to return_page & return ¬
  37.         & "<H4>from_user</H4>" & return & from_user & return ¬
  38.         & "<H4>server_name</H4>" & return & server_name & return ¬
  39.         & "<H4>server_port</H4>" & return & server_port & return
  40.     set return_page to return_page & return ¬
  41.         & "<H4>script_name</H4>" & return & script_name & return ¬
  42.         & "<H4>content_type</H4>" & return & content_type & return ¬
  43.         & "<H4>username</H4>" & return & username & return ¬
  44.         & "<H4>password</H4>" & return
  45.     set return_page to return_page ¬
  46.         & "<HR><I>Results generated at: " & (current date) ¬
  47.         & "</I>" & "</BODY></HTML>"
  48.     return return_page
  49.     
  50. end «event WWWΩsdoc»
  51.